class CreateTasks < ActiveRecord::Migration
  def self.up
    create_table :tasks do |t|
      t.string :title, :limit => 100, :null => false
      t.text :description, :null => false
      t.date :dateline, :null => false
      t.decimal :value, :null => false, :default => 0.0
      t.references :lesson, :null => false
      t.references :answer

      t.timestamps
    end
    add_index(:tasks,[:title,:lesson_id], :unique => true, :name => "uk_task_lesson")
  end

  def self.down
    drop_table :tasks
  end
end
